{% extends "CmsBundle::base.html.twig" %}

{% block pagestyles %}
    <link rel="stylesheet" href="/assets/cms/css/chosen.css" />
{% endblock %}

{% block pagerow %}
    <div class="col-xs-12">
    <!-- PAGE CONTENT BEGINS -->
        <form class="form-horizontal" role="form" action="{{ path("yearnfar_cms_menu_add") }}" method="post">
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 菜单名称： </label>
                <div class="col-sm-9">
                    <input type="text" name="name" placeholder="添加菜单" class="col-xs-10 col-sm-5">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 上一级菜单： </label>
                <div class="col-sm-9">
                    <select class="width-20 chosen-select" name="pid" id="form-field-select-3" data-placeholder="上一级菜单">
                        <option value="0">顶级菜单</option>
                        {% for k, item in menu %}
                            <option value="{{ k }}">{{ item.aName }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 路由： </label>
                <div class="col-sm-9">
                    <input type="text" name="route" placeholder="/menu/add" class="col-xs-10 col-sm-5">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 样式： </label>
                <div class="col-sm-9">
                    <input type="text" name="class" placeholder="icon-file-text" class="col-xs-10 col-sm-5">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 权限设置： </label>
                <div class="col-sm-4">
                    <table>
                        {% for k, item in groups %}
                        <!-- 一行3个 -->
                        {% if k % 3==0 %}
                        <tr>
                            {% endif %}
                            <td class="col-xs-1">
                                <label class="block">
                                    <input name="power[]" {% if k==0 %}disabled="" checked="checked"{% endif %} type="checkbox" value="{{ item.privilege }}" class="ace">
                                    <span class="lbl"> {{ item.name }} </span>
                                </label>
                            </td>
                            {% endfor %}
                        <tr>
                    </table>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 描述： </label>
                <div class="col-sm-9">
                    <textarea class="col-sm-4 col-xs-3" name="description" placeholder="添加新的后台功能菜单"></textarea>
                </div>
            </div>

            <div class="clearfix form-actions">
                <div class="col-md-offset-3 col-md-9">
                    <button class="btn btn-info" type="submit" name="submit" value="1">
                        <i class="icon-ok bigger-110"></i>
                        提交
                    </button>

                    &nbsp; &nbsp; &nbsp;
                    <button class="btn" type="reset">
                        <i class="icon-undo bigger-110"></i>
                        重置
                    </button>
                </div>
            </div>
        </form>
    <!-- PAGE CONTENT ENDS -->
    </div><!-- /.col -->
{% endblock %}

{% block pagescripts %}
    <script src="/assets/cms/js/chosen.jquery.min.js"></script>
{% endblock %}

{% block inlinescripts %}
    <script type="text/javascript">
        $(".chosen-select").chosen();
    </script>
{% endblock %}